
$(".login-type>input,.switchbutton").click(function () {
    $(".msg-type,.pwd-type").toggleClass("hide");
});
$(document).ready(function () {
    $(".switchbutton").click(function () {
        $(".msg-type,.pwd-type").toggleClass("hide");
    });
});

//用户登录
function checkForm() {
	var username=$('#username').val();
	var password=$('#password').val();
    if (username==''){
        $("[data-toggle='popover']").popover();
        $('.username').popover('show');
    }else if (password==''){
        $("[data-toggle='popover']").popover();
        $('.password').popover('show');
    }else {
        $('.username').popover('hide');
        $('.password').popover('hide');
        $.ajax({
            type: "POST",
            url: ctx+"/login/doLogin",
            data: $("#loginForm").serialize(),
            dataType: "json",
            success: function(data){
            	if(data.statusCode==1){
            		window.location.href = ctx+"/login/gotoMain";
            	}else{
            		alert(data.message)
            	}
            }
        });
    }

}

function register(){
	//alert("register");
	window.location.href = ctx+"/login/register";
}



